<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

Route::get('think', function () {
    return 'hello,ThinkPHP6!';
});

Route::get('hello/:name', 'index/hello');

// Route::get('/swagger', function() {
//     $openapi = OpenApi\scan(root_path().'app');
//      // $openapi = OpenApi\scan('../app');//当然,你也可以用这种相对路径的写法,但是我建议还是用上面,避免更换route路径后出现问题
//      header('Content-Type: application/json');
//      echo $openapi->toJson();
//  });

 Route::get('/swagger', function() {
    $openapi = \OpenApi\scan('../app');
    header('Content-Type: application/json');
    echo $openapi->toJson();
});